package cn.iocoder.yudao.module.lfd.dal.mysql.wallet;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.lfd.dal.dataobject.wallet.WalletDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.lfd.controller.admin.wallet.vo.*;

/**
 * 钱包 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface WalletMapper extends BaseMapperX<WalletDO> {

    default PageResult<WalletDO> selectPage(WalletPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WalletDO>()
                .eqIfPresent(WalletDO::getType, reqVO.getType())
                .eqIfPresent(WalletDO::getAmount, reqVO.getAmount())
                .betweenIfPresent(WalletDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(WalletDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(WalletDO::getAppointmentId, reqVO.getAppointmentId())
                .orderByDesc(WalletDO::getId));
    }

    default List<WalletDO> selectList(WalletExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WalletDO>()
                .eqIfPresent(WalletDO::getType, reqVO.getType())
                .eqIfPresent(WalletDO::getAmount, reqVO.getAmount())
                .betweenIfPresent(WalletDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(WalletDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(WalletDO::getAppointmentId, reqVO.getAppointmentId())
                .orderByDesc(WalletDO::getId));
    }

}
